﻿#region Copyright

//  ======================================================
//      Copyright (c) 2011 Toulr All rights reserved.
//     
//      The use and distribution terms for this software are contained in the file
//      named license.txt, which can be found in the root of this distribution.
//      By using this software in any fashion, you are agreeing to be bound by the
//      terms of this license.
//     
//     You must not remove this notice, or any other, from this software.
//  ======================================================

#endregion

using System;
using System.Collections.Generic;
using System.Threading;
using NUnit.Framework;
using Toulr.Util.Net;

namespace Toulr.Test.Util
{
    /// <summary>
    /// 测试ActiveMQ工具类
    /// </summary>
    public class ActiveMqFixture
    {
        ActiveMq _mq = new ActiveMq("tcp://localhost:61616/","ToulrClient");
        [SetUp]
        public void Init()
        {
            
        }
        [Test]
        public void Start()
        {
            Thread sendThread =new Thread(new ThreadStart(SendMessage) );
            sendThread.Start();
            StartListener();
        }
        /// <summary>
        /// 发送测试用消息
        /// </summary>
        private void SendMessage()
        {
//            while (true)
//            {
//                _mq.SendMessage("Toulr", new List<string> { DateTime.Now.Millisecond.ToString() });
//                Thread.CurrentThread.Join(1000);
//            }
        }
        /// <summary>
        /// 开始消息监听
        /// </summary>
        private  void StartListener()
        {
//            _mq.StartListener(new List<string>{"Toulr"});
        }
    }
}